<template>
    <view class="container">
         <BackButton />
        <!-- 顶部导航区 -->
        <view style="background-color: white;padding-left: 26rpx;padding-right: 26rpx;">
            <Header :header-data="headerData" />

            <!-- 地图展示区（模拟，实际需集成地图 SDK） -->
            <view class="map-section">
                <!-- 添加伙伴信息展示层 -->
                <view class="partner-info" v-if="nearbyPartners > 0">
                    <view class="partner-count">附近有<text class="partner-number">{{ nearbyPartners }}</text>位伙伴</view>
                    <view class="fastest-time">最快{{ fastestOrderTime }}分钟接单</view>
                </view>
                <map-component :latitude="latitude" :longitude="longitude" :markers="markers"
                    @marker-tap="handleMarkerTap" />
            </view>
        </view>
        <!-- 功能按钮区 -->
        <view style="background-color: white;padding: 10rpx;margin-top: 30rpx;">
            <view class="func-section">
                <view class="func-row" v-for="(row, index) in funcItemsone" :key="index">
                    <view class="func-item" v-if="isBaseUrlReady" v-for="item in row" :key="item.id"
                        :style="{ backgroundImage: 'url(' + getFullImageUrl(item.bgImage) + ')' }"
                        @click="navigateToRelease(item.id)"> <!-- 添加点击事件并传递item.text -->
                        <image class="func-icon" :src="getFullImageUrl(item.icon)"></image>
                        <text class="func-text">{{ item.text }}</text>
                        <text class="func-desc">{{ item.desc }}</text>
                    </view>
                </view>
                <view class="func-row" v-for="(row, index) in funcItemstwo" :key="index">

                    <view class="func-item" v-for="item in row" :key="item.id" v-if="isBaseUrlReady && item.text"
                        :style="{ backgroundImage: 'url(' + getFullImageUrl(item.bgImage) + ')' }"
                        @click="navigateToRelease(item.id)"> <!-- 添加item.text存在性检查 -->
                        <image class="func-icon" :src="getFullImageUrl(item.icon)"></image>
                        <text class="func-text">{{ item.text }}</text>
                        <text class="func-desc">{{ item.desc }}</text>
                    </view>
                </view>
                <!-- AI 需求发布 -->
                <view class="ai-btn" @click="navigateToRelease">
                    <text class="ai-text">{{ headerData.bt_text }}</text>
                    <text class="ai-desc">{{ headerData.bt_desc }}</text>
                </view>
            </view>
        </view>
        <!-- 新增签到组件 -->
        <SignIn />
        
        <!-- 平台保障区 -->
        <view style="background-color: white;padding: 10rpx;margin-top: 30rpx;">
            <view class="security-section">
                <view class="security-header" style="display: flex; align-items: center;">
                    <view
                        style="width:7rpx;height:36rpx;background:#BEFF32;border-radius:0rpx 5rpx 5rpx 0rpx;margin-left: 8rpx;">
                    </view>
                    <text class="security-title" style="margin-left:20rpx;position: relative;top: 10rpx;">平台的保障</text>
                </view>
                <view class="security-row" v-for="(row, idx) in securityItemsone" :key="idx">
                    <view class="security-card" v-for="card in row" :key="card.id">
                        <image class="card-icon" :src="getFullImageUrl(card.icon)"></image>
                        <text class="card-title">{{ card.title }}</text>
                        <text class="card-desc">{{ card.desc }}</text>
                    </view>
                </view>
                <view class="security-row" v-for="(row, idx) in securityItemstwo" :key="idx">
                    <view class="security-card" v-for="card in row" :key="card.id">
                        <image class="card-icon" :src="getFullImageUrl(card.icon)"></image>
                        <text class="card-title">{{ card.title }}</text>
                        <text class="card-desc">{{ card.desc }}</text>
                    </view>
                </view>
            </view>
        </view>

        <!-- 认证弹窗 -->
        <authWin ref="authWinRef" @close="closeAuthWin"></authWin>

    </view>
</template>


<script src="./index.js"></script>
<style lang="scss" src="./index.scss"></style>
